import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import config from 'src/config';

@Injectable()
export class AdminStrategy extends PassportStrategy(Strategy,'admin-jwt') {
	constructor() {
		super({
			jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
			ignoreExpiration: false,
			secretOrKey: config.admin.secret,
		});
	}

	async validate(payload: any) {
		return payload
	}
}
